﻿using System.ComponentModel.DataAnnotations;

namespace BootstrapBlazorApp.OnlyServer.Data
{
    public class Student
    {
        [Required]
        public int Id { get; set; }

        [Required(ErrorMessage = "{0} 不可为空")]
        [Display(Name = "姓名")]
        [MaxLength(50, ErrorMessage = "最多50个字符")]
        public string? Name { get; set; }

        [Required(ErrorMessage ="{0} 不可为空")]
        [Display(Name = "年龄")]
        [Range(18,40,ErrorMessage ="{0} 18到40之间")]
        public int Age { get; set; }

        [Required]
        [Display(Name = "地址")]
        public string? Address { get; set; }

        [Required(ErrorMessage ="{0} 不可为空")]
        [Display(Name="正在学习中")]
        public bool? IsStudying { get; set; }

        //[Required(ErrorMessage ="{0} 不可为空")]
        //[Display(Name="是否中国人")]
        public bool? IsChina { get; set; }

        [Required(ErrorMessage = "{0} 不可为空")]
        [Display(Name="国家")]
        public string? Country { get; set; }

        [Required(ErrorMessage = "{0} 不可为空")]
        [Display(Name = "省份")]
        public string? Province { get; set; }
    }
}
